var t = getApp();

Page({
    data: {
        language: "",
        statusType: 0,
        statusTabs: [ {
            name: 0,
            title: "全部"
        }, {
            name: 1,
            title: "已结算"
        }, {
            name: 2,
            title: "未结算"
        }, {
            name: 5,
            title: "预计佣金"
        }, {
            name: 3,
            title: "已冻结"
        }, {
            name: 4,
            title: "已失效"
        } ],
        page: 1,
        loading: !1,
        finished: !1,
        statisticsInfo: null,
        list: []
    },
    onLoad: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {
        this.getData();
    },
    getData: function() {
        var a = this;
        wx.showLoading({
            title: "Loading"
        });
        var e = t.getNetAddresss("plugin.fk-distribution.frontend.controllers.center.index");
        t._getNetWork({
            url: e,
            data: {
                page: this.data.page,
                record_status: this.data.statusType
            },
            success: function(e) {
                var i = e.data, n = i.result, s = i.msg, g = i.data, d = g.list;
                if (1 != n) return t.tips(s), !1;
                1 == a.data.page && a.setData({
                    statisticsInfo: g.info
                }), (a.data.page >= d.last_page || d.data.length < d.per_page) && a.setData({
                    finished: !0
                }), a.setData({
                    list: a.data.page > 1 ? a.data.list.concat(d.data) : d.data,
                    page: ++a.data.page
                });
            },
            complete: function() {
                wx.hideLoading();
            }
        });
    },
    changeStatus: function(t) {
        this.setData({
            statusType: t.detail.name
        }), this.initGetData(), this.getData();
    },
    initGetData: function() {
        this.setData({
            page: 1,
            finished: !1,
            loading: !1
        });
    },
    onReachBottom: function() {
        if (this.data.finished) return !1;
        this.getData();
    }
});